//
//  PTViewController.m
//  PTPageKit
//
//  Created by flypigrmvb on 11/23/2017.
//  Copyright (c) 2017 flypigrmvb. All rights reserved.
//

#import "PTViewController.h"
#import "PTDetailViewController.h"
#import "PTPageHeaderModel.h"

@interface PTViewController ()

@end

@implementation PTViewController

- (instancetype)init {
    self = [super init];
    if (self) {
        self.bgImage = [UIImage imageNamed:@"pop_page_bg_panel"];
        self.edgeInsets = UIEdgeInsetsMake(60, 30, 60, 30);
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.bgImage = [UIImage imageNamed:@"pop_page_bg_panel"];
        self.edgeInsets = UIEdgeInsetsMake(60, 30, 60, 30);
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    NSMutableArray* titleModels = [[NSMutableArray alloc] init];
    {
        PTPageHeaderModel* headerModel = [[PTPageHeaderModel alloc] init];
        headerModel.title = @"第一个";
        headerModel.selectedBgImage = [UIImage imageNamed:@"three_item_tab1"];
        headerModel.normalBgImage = [UIImage imageNamed:@"three_item_tab1_mask"];
        [titleModels addObject:headerModel];
    }
    {
        PTPageHeaderModel* headerModel = [[PTPageHeaderModel alloc] init];
        headerModel.title = @"第二个";
        headerModel.selectedBgImage = [UIImage imageNamed:@"three_item_tab2"];
        headerModel.normalBgImage = [UIImage imageNamed:@"three_item_tab2_mask"];
        [titleModels addObject:headerModel];
    }
    {
        PTPageHeaderModel* headerModel = [[PTPageHeaderModel alloc] init];
        headerModel.title = @"第三个";
        headerModel.selectedBgImage = [UIImage imageNamed:@"three_item_tab3"];
        headerModel.normalBgImage = [UIImage imageNamed:@"three_item_tab3_mask"];
        [titleModels addObject:headerModel];
    }
    self.pageHeaderTitles = titleModels;
    
    
    NSMutableArray* VCs = [[NSMutableArray alloc] init];
    {
        PTDetailViewController* detailVC = [[PTDetailViewController alloc] init];
        detailVC.title = @"第一个";
        detailVC.view.backgroundColor = [UIColor orangeColor];
        [VCs addObject:detailVC];
    }
    {
        PTDetailViewController* detailVC = [[PTDetailViewController alloc] init];
        detailVC.title = @"第二个";
        detailVC.view.backgroundColor = [UIColor yellowColor];
        [VCs addObject:detailVC];
    }
    {
        PTDetailViewController* detailVC = [[PTDetailViewController alloc] init];
        detailVC.title = @"第三个";
        detailVC.view.backgroundColor = [UIColor greenColor];
        [VCs addObject:detailVC];
    }
    self.pageBodyViewControllers = VCs;
    
    [self reloadData];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

